package com.zengde.chapter1.config;

import com.zengde.chapter1.pojo.User;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

// 标注为Java配置类
@Configuration
@ComponentScan(value = "com.zengde.chapter1.*",lazyInit = false)
//@ComponentScan(basePackages = {"com.zengde.chapter1.pojo"})
//@ComponentScan(basePackageClasses = {User.class})
public class AppConfig {
// @Bean表示将initUser()方法返回的对象装配到IoC容器中，该方法的属性name表示Bean的名称
    /*@Bean(name = "user")
    public User initUser() {
        var user = new User();
        user.setId(1L);
        user.setUserName("user_name_1");
        user.setNote("note_1");
        return user;
    }*/
}
